package com.mine.modules.vm.domain.query;

import lombok.Data;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Data
public class FieldStatsQuery {

    private String fieldName;

    private List<String> layerIds;

    public FieldStatsQuery() {
    }

    public FieldStatsQuery(String fieldName, List<String> layerIds) {
        this.fieldName = fieldName;
        this.layerIds = layerIds;
    }

    private static final Set<String> ALLOWED_FIELDS = new HashSet<>(Arrays.asList(
            "run_current_status",
            "run_fault_frequency",
            "run_key_param_stability",
            "run_load_capacity",
            "wh_plan_execution_rate",
            "wh_record_integrity",
            "wh_personnel_qualifications",
            "wh_preventive_coverage",
            "bp_spare_part_inventory",
            "bp_spare_part_quality",
            "bp_supply_chain_reliability",
            "bp_change_efficiency",
            "lh_aging_degree",
            "lh_eliminate_risk",
            "lh_life_prediction",
            "hj_flexibility",
            "hj_prevention_level",
            "hj_event_history",
            "jjx_upkeep_cost_ratio",
            "jjx_shutdown_losses",
            "jjx_jg_xjb"
    ));

    public String getSafeFieldName() {
        return ALLOWED_FIELDS.contains(fieldName) ? fieldName : "run_current_status";
    }

}
